Message
note you can use v chat test server base url is
http://170.178.195.150:81/api/v1/1 - Get all message by room and loadMore
- URL: {{baseUrl}}message?lastId=first&roomId=61cd92223bd8731be040e11e
- Method: GET
- Content-Type: JSON
- Authentication: Bearer token is required in header in
authorization : Bearer yourToken- Example request data in query param put:
{
    "lastId":"first",
    "roomId":"61cd92223bd8731be040e11e"
}
| Parameter | Required | Description | 
|---|---|---|
| lastId | true | if you pass first then will get you first 30 message to get next messages you need to pass the last message id in your list | 
| roomId | true | room id | 
Example response:
{
  "success": true,
  "data": [
    {
      "_id": "61cd922a3bd8731be040e138",
      "messageType": "text",
      "messageAttachment": null,
      "createdAt": 1640862250273,
      "content": "first",
      "senderId": "61cd8fb33bd8731be040e103",
      "senderName": "user1 updated name",
      "senderImageThumb": "REGISTER_3c651b24-3912-4191-a131-af99292a75f9_THUMB.jpg",
      "roomId": "61cd92223bd8731be040e11e"
    },
    {
      "_id": "61cd92223bd8731be040e128",
      "messageType": "text",
      "messageAttachment": null,
      "createdAt": 1640862242839,
      "content": "first",
      "senderId": "61cd8fb33bd8731be040e103",
      "senderName": "user1 updated name",
      "senderImageThumb": "REGISTER_3c651b24-3912-4191-a131-af99292a75f9_THUMB.jpg",
      "roomId": "61cd92223bd8731be040e11e"
    }
  ]
}
- messageTypeall available types is
- [text, voice, image, video, file, reply, allDeleted, location, forward, create, join, leave, upgrade, downgrade, info, kick, add]
2 - Create Message to chat
1 send text message
- URL: {{baseUrl}}message/single or {{baseUrl}}message/group for group chat
- Method: POST
- Content-Type: form-datato send image or attachment
- Authentication: Bearer token is required in header in authorization : Bearer yourToken
- Example request data:
{
    "content":"message text",
    "roomId":"61cd92223bd8731be040e11e",
    "type":"text"
}
| Parameter | Required | Description | 
|---|---|---|
| content | true | message text if image pass this content is image | 
| roomId | true | room id | 
| type | true | message type it can be [text,image,voice,video,file] | 
Example response:
{
  "success": true,
  "data": "success to send to single chat"
}
don't add the message manually to your design you will receive the message in socket message name space
2 send image message
- URL: {{baseUrl}}message/single or {{baseUrl}}message/group for group chat
- Method: POST
- Content-Type: form-datato send image or attachment
- Authentication: Bearer token is required in header in authorization : Bearer yourToken
- Example request data:
{
    "content":"This content image ๐ท",
    "roomId":"61cd92223bd8731be040e11e",
    "type":"image",
    "file":"mutil part file",
    "attachment":{
      "fileSize:"100 kb",
      "height":"100",
      "width":"200"
    }
}
| Parameter | Required | Description | 
|---|---|---|
| content | true | message text if image pass this content is image | 
| roomId | true | room id | 
| file | true | image file to send | 
| type | true | message type it can be [text,image,voice,video,file] | 
| attachment | true if type not text | get image data and pass it {"fileSize:"100 kb","height":"100","width":"200"} | 
Example response:
{
  "success": true,
  "data": "success to send to single chat"
}
3 send voice message
- URL: {{baseUrl}}message/single or {{baseUrl}}message/group for group chat
- Method: POST
- Content-Type: form-datato send image or attachment
- Authentication: Bearer token is required in header in authorization : Bearer yourToken
- Example request data:
{
    "content":"This content voice ๐ค",
    "roomId":"61cd92223bd8731be040e11e",
    "type":"voice",
    "file":"mutil part file",
    "attachment":{
      "fileSize:"200 kb",
      "fileDuration":"00:10"
    }
}
| Parameter | Required | Description | 
|---|---|---|
| content | true | message text if image pass this content is image | 
| roomId | true | room id | 
| file | true | voice file to send | 
| type | true | message type it can be [text,image,voice,video,file] | 
| attachment | true if type not text | get voice data and pass it {"fileSize:"200 kb","fileDuration":"00:10"} | 
Example response:
{
  "success": true,
  "data": "success to send to single chat"
}
4 send video message
- URL: {{baseUrl}}message/single or {{baseUrl}}message/group for group chat
- Method: POST
- Content-Type: form-datato send image or attachment
- Authentication: Bearer token is required in header in authorization : Bearer yourToken
- Example request data:
{
    "content":"This content video ๐ฝ",
    "roomId":"61cd92223bd8731be040e11e",
    "type":"video",
    "file":[mutil part video thumb image , mutil part video file],
    "attachment":{
      "fileSize:"200 kb",
      "fileDuration":"00:10",
      "height":"100", // video thumnal image height
      "width":"200"   // video thumnal image width
    }
}
| Parameter | Required | Description | 
|---|---|---|
| content | true | message text if image pass this content is image | 
| roomId | true | room id | 
| file | true | ist array of muti part => first mutil part file is video thumb second is video file dont change this order | 
| type | true | message type it can be [text,image,voice,video,file] | 
| attachment | true if type not text | get voice data and pass it {"fileSize:"200 kb","fileDuration":"00:10","height":"100","width":"200"} | 
Example response:
{
  "success": true,
  "data": "success to send to single chat"
}
5 send video message
- URL: {{baseUrl}}message/single or {{baseUrl}}message/group for group chat
- Method: POST
- Content-Type: form-datato send image or attachment
- Authentication: Bearer token is required in header in authorization : Bearer yourToken
- Example request data:
{
    "content":"This content file ๐",
    "roomId":"61cd92223bd8731be040e11e",
    "type":"file",
    "file":"mutil part file to send",
    "attachment":{
      "fileSize:"200 kb",
      "linkTitle":"this is file name"
    }
}
| Parameter | Required | Description | 
|---|---|---|
| content | true | message text if image pass this content is image | 
| roomId | true | room id | 
| file | true | mutil part file to send | 
| type | true | message type it can be [text,image,voice,video,file] | 
| attachment | true if type not text | get voice data and pass it {"fileSize:"200 kb","linkTitle":"this is file name"} | 
Example response:
{
  "success": true,
  "data": "success to send to single chat"
}